package com.briup.jz.service.impl;

import com.briup.jz.bean.BaseConfigExample;
import com.briup.jz.bean.BaseLog;
import com.briup.jz.bean.BaseLogExample;
import com.briup.jz.dao.BaseLogMapper;
import com.briup.jz.dao.CertificationApplyMapper;
import com.briup.jz.service.IBaseLogService;
import com.briup.jz.utils.CustomerException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BaseLogServiceImpl implements IBaseLogService {


    //依赖注入
    @Resource
    private BaseLogMapper baseLogMapper;



    @Override
    public void saveOrUpdat(BaseLog baseLog) throws CustomerException {

        if (baseLog.getId()!=null){
            //更新操作
            baseLogMapper.updateByPrimaryKey(baseLog);
        }else {
            baseLogMapper.insert(baseLog);
        }
    }

    @Override
    public List<BaseLog> query(String realname) {

       //创建一个模板参数
        BaseLogExample example=new BaseLogExample();
        if (realname!=null){
            example.createCriteria().andRealnameLike("%"+realname+"%");
        }
        return baseLogMapper.selectByExample(example);
    }

    @Override
    public void deleteById(Long id) throws CustomerException {

        baseLogMapper.deleteByPrimaryKey(id);
    }


    @Override
    public List<BaseLog> page(int page, int patesize) {
       BaseLogExample example=new BaseLogExample();
       return null;
    }
}
